// 封装 数据库api 

var mysql = require('mysql')

exports.base = (sql , data ,callback) =>{
	//创建数据库链接
	var connection = mysql.createConnection({
	  host     : 'localhost',
	  user     : 'root',
	  password : '123456',
	  database : 'test'
	});
	// 执行链接操作
	connection.connect();
	
	connection.query(sql,data ,function (error, results, fields) {
	  if (error) throw error;
	  callback(results);
	});
	
	connection.end();
}